/*
 * Vec2D.h
 *
 *  Created on: Jun 24, 2012
 *      Author: burek
 */

#ifndef VEC2D_H_
#define VEC2D_H_

struct Vec3D;

struct Vec2D
{
    float X, Y;

    Vec2D( void );
    Vec2D( const float x, const float y);

    Vec2D& operator= ( const Vec2D& A );
    bool operator== ( const Vec2D& A ) const;
    bool operator!= ( const Vec2D& A ) const;
    Vec2D operator+ ( const Vec2D& A ) const;
    Vec2D operator- ( const Vec2D& A ) const;
    Vec2D operator* ( const Vec2D& A ) const;
    Vec2D operator/ ( const Vec2D& A ) const;
    Vec2D operator* ( const float A ) const;
    Vec2D operator/ ( const float A ) const;
    float dot( const Vec2D& A ) const;
    float length( void ) const;
    float lengthSquared( void ) const;
    void set(float x, float y);
    Vec2D normalize(void) const;
    float distanceTo(const Vec2D& A) const;
    float distanceSquared(const Vec2D& A) const;

    void normalizeIP(void);
    void operator+= ( const Vec2D& A );
    void operator*= ( const Vec2D& A );
    void operator/= ( const Vec2D& A );
    void operator-= ( const Vec2D& A );
    void operator*= ( const float A );
    void operator/= ( const float A );

    void lerpIP( const Vec2D& A, const float x );
    Vec2D lerp( const Vec2D& A, const float x ) const;

    static const Vec2D Zero;
    static const Vec2D One;

    static const Vec2D XUnit;
    static const Vec2D YUnit;

    static const Vec2D NegXUnit;
    static const Vec2D NegYUnit;
};

#endif /* VEC2D_H_ */
